/*
 * @Author: 吴世扬 18368095041@163.com
 * @Date: 2025-02-25 08:45:35
 * @LastEditors: 吴世扬 18368095041@163.com
 * @LastEditTime: 2025-02-25 09:39:45
 * @FilePath: /vue3-admin-server/src/shareModules/jwt.module.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Module } from '@nestjs/common';
import { JwtModule, type JwtModuleOptions } from '@nestjs/jwt';

import { ACCESS_TOKEN_EXPIRES } from 'src/common/constants';

const jwtConfig: JwtModuleOptions = {
    secret: process.env.JWT_SECRET ?? 'fallback_secret',
    signOptions: {
        expiresIn:
            (process.env.ACCESS_TOKEN_EXPIRES ?? ACCESS_TOKEN_EXPIRES) + 's'
    }
};

@Module({
    imports: [JwtModule.register(jwtConfig)],
    exports: [JwtModule]
})
export class JwtShareModule {}
